{% extends 'common/_base.html' %}
{% block title %}新建LDAP服务{% endblock %}
{% block localcss %}
    <link rel="stylesheet" href="/static/assets/vendors/select2/select2.min.css">
    <link rel="stylesheet" href="/static/assets/css/style.css">
{% endblock %}
{% block content %}
    <nav class="page-breadcrumb">
        <ol class="breadcrumb">
           			<ol class="breadcrumb">
						<li class="breadcrumb-item"><a href="/">首页</a></li>
                        <li class="breadcrumb-item"><a href="/accounts/role/list/">DLAP服务列表</a></li>
						<li class="breadcrumb-item active" aria-current="page">新建LDAP服务</li>
					</ol>
        </ol>
    </nav>
    <div class="row">
        <div class="col-md-12 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">

                    <h6 class="card-title">新建LDAP服务</h6>
                    <form method="post" class="forms-sample">

                        <div class="form-group col-sm-4">
                            <label for="host">{{ form.host.label }}</label>
                            <input type="text" class="form-control" id="host" autocomplete="off"
                                   placeholder="" name="host">
                        <p>{% if form.host.errors %}{{ form.host.errors }}{% endif %}</p>

                        </div>

                        <div class="form-group col-sm-2">
                            <label for="port">{{ form.port.label }}</label>
                            <input type="number" class="form-control" id="port" autocomplete="off"
                                   placeholder="" name="port" value="389">
                        <p>{% if form.port.errors %}{{ form.port.errors }}{% endif %}</p>

                        </div>

                        <div class="form-group col-sm-4">
                            <label for="user">{{ form.user.label }}</label>
                            <input type="text" class="form-control" id="user" autocomplete="new-password"
                                   placeholder="" name="user">
                        <p>{% if form.user.errors %}{{ form.user.errors }}{% endif %}</p>

                        </div>

                        <div class="form-group col-sm-4">
                            <label for="password">{{ form.password.label }}</label>
                            <input type="password" class="form-control" id="password" autocomplete="new-password"
                                   placeholder="" name="password">
                        <p>{% if form.password.errors %}{{ form.password.errors }}{% endif %}</p>

                        </div>

                       <div class="form-group col-sm-2">
									<label> {{ form.ldap_server.label }}</label>
									<select class="js-example-basic-multiple w-100" name="ldap_server">
                                        {% for i in form.ldap_server %}
                                        {{ i }}
                                        {% endfor %}
									</select>
                        </div>

                    <div class="form-group col-sm-2">
                        <div class="form-check form-check-flat form-check-primary">
                            <label class="form-check-label">
                                <input type="checkbox" class="form-check-input" name="use_ssl">
                                {{ form.use_ssl.label }}
                            </label>
                        </div>
                    </div>

                    <div class="form-group col-sm-4">
                            <label for="ldap_base_dn">{{ form.ldap_base_dn.label }}</label>
                            <input type="text" class="form-control" id="ldap_base_dn" autocomplete=""
                                   placeholder="" name="ldap_base_dn">
                        <p style="color: gray;">从LDAP根节点搜索用户和组。例如: dc=10dream,dc=com。</p>
                        <p>{% if form.ldap_base_dn.errors %}{{ form.ldap_base_dn.errors }}{% endif %}</p>

                        </div>

                    <div class="form-group col-sm-4">
                            <label for="ldap_user_dn">{{ form.ldap_user_dn.label }}</label>
                            <input type="text" class="form-control" id="ldap_user_dn" autocomplete=""
                                   placeholder="" name="ldap_user_dn">
                    <p style="color: gray;">搜索用户时，基于基础DN的搜索范围限制。例如: ou=People。</p>
                        <p>{% if form.ldap_user_dn.errors %}{{ form.ldap_user_dn.errors }}{% endif %}</p>

                        </div>

                    <div class="form-group col-sm-4">
                            <label for="ldap_group_dn">{{ form.ldap_group_dn.label }}</label>
                            <input type="text" class="form-control" id="ldap_group_dn" autocomplete=""
                                   placeholder="" name="ldap_group_dn">
                        <p style="color: gray;">搜索组时，基于基础DN的搜索范围限制。例如: ou=Group。</p>
                        <p>{% if form.ldap_group_dn.errors %}{{ form.ldap_group_dn.errors }}{% endif %}</p>

                        </div>


                       <div class="form-group col-sm-4">
									<label> {{ form.ldap_user_object_class.label }}</label>
									<select class="js-example-basic-multiple w-100" name="ldap_user_object_class">
                                        {% for i in form.ldap_user_object_class %}
                                        {{ i }}
                                        {% endfor %}
									</select>
                       <p style="color: gray;">加载用户时使用的LDAP用户对象类。例如: inetorgperson。</p>
                        </div>

                    <div class="form-group col-sm-4">
									<label> {{ form.ldap_group_object_class.label }}</label>
									<select class="js-example-basic-multiple w-100" name="ldap_group_object_class">
                                        {% for i in form.ldap_group_object_class %}
                                        {{ i }}
                                        {% endfor %}
									</select>
                       <p style="color: gray;">加载群组时要搜索的 LDAP 属性。例如: groupOfUniqueNames。</p>
                        </div>


                    <div class="form-group col-sm-4">
                            <label for="desc">{{ form.desc.label }}</label>
                            <input type="text" class="form-control" id="desc" autocomplete=""
                                   placeholder="" name="desc">
                        <p>{% if form.desc.errors %}{{ form.desc.errors }}{% endif %}</p>

                        </div>

                        <button type="submit" class="btn btn-primary mr-2">提交</button>
                        <a href="/accounts/ldapserver/list/" class="btn btn-warning" style="width: 50pt">返回</a>
                    </form>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block localjs %}
    <script src="/static/assets/vendors/select2/select2.full.min.js"></script>
    <script src="/static/assets/js/select2.js"></script>
{% endblock %}